#include <iterator>
#include <iostream>
#include <vector>
#include <list>
#include <deque>
#include <algorithm>
using namespace std;
int main()
{
  //inserter
  typedef deque<int> ConInt;
  ConInt d;
  for(int i = 0;i<5;i++)
    d.push_front(i*10);
  copy(d.begin(),d.end(),ostream_iterator<ConInt::value_type>(cout," ") );
  cout<<endl;
  //-------------------------------
  vector<int> v0;
  for(int i = 1;i<5;i++)
    v0.push_back(i*i);
  copy(v0.begin(),v0.end(),ostream_iterator<ConInt::value_type>(cout," "));
  cout<<endl;
  //-------------------------------back_inserter
  copy(d.rbegin(),d.rend(),back_inserter(d));
  copy(d.begin(),d.end(),ostream_iterator<ConInt::value_type>(cout," "));
  cout<<endl;
  //-------------------------------front_inserter
  copy(v0.begin(),v0.end(),front_inserter(d));
  copy(d.begin(),d.end(),ostream_iterator<ConInt::value_type>(cout," "));
  cout<<endl;
  //-------------------------------inserter
  deque<int>::iterator iter = d.begin();
  cout<<"*iter: "<<*iter<<endl;
  copy(v0.begin(),v0.end(),inserter(d,d.begin()));
  copy(d.begin(),d.end(),ostream_iterator<ConInt::value_type>(cout," "));
  cout<<endl;
  cout<<"*iter: "<<*iter<<endl;
  //-------------------------------
  //reverse_iterator

  return 0;
}
